package com.foreknow.demo1;

import java.util.Scanner;

public class ControllerDemo2 {
    public static void main(String[] args) {
        //生成一个随机数
        int random = (int) (Math.random()*10);
        //从控制台接收一个四位的会员卡号 1234
        Scanner input = new Scanner(System.in);
        System.out.println("请输入四位的会员卡号: ");
        int member = input.nextInt();
        //通过分解获取到百位 /  %
        int num = member / 100 % 10;
        //如果获取到的百位的数字等于随机数就是幸运会员，否则输出谢谢支持。
        if (num == random){
            System.out.println(member + "您是会员.......");
        }else {
            System.out.println("谢谢支持.......");
        }
    }
}
